#include "SystemVshm.hpp"

//读取端

int main()
{
    // key_t key = GetKey();
    // //cout<<"0x"<<hex<<key<<endl;
    // int shmid = GetShm(key,fsize);
    // //cout<<shmid<<endl;

    // char* s = (char*)AttackShm(shmid);

    SHM<char> s(READ);

    //char str[1024] = {0};

    while(true)
    {
        //int n = snprintf(str,sizeof(str)-1,"%s",s());
        //if(n > 0)
        {
            //str[n] = 0;
            if(strcasecmp(s(),"quit") == 0) break;
            cout<<s()<<endl;
            sleep(1);
        }
    }

    //解除链接
    //DetachShm(s);

    return 0;
}